package test

import (
	"context"
	"encoding/json"
	"fmt"
	"github.com/hibiken/asynq"
)

func Queue(ctx context.Context, t *asynq.Task) error {
	var req struct {
		OrderNo string `json:"order_no" binding:"required"`
		Limit   int    `json:"limit" binding:"required"`
	}
	if err := json.Unmarshal(t.Payload(), &req); err != nil {
		return fmt.Errorf("解析请求参数失败: %w", err)
	}
	if req.Limit > 3 {
		return nil
	}

	return nil
}
